
<%@ page import="com.surelution.projects.crm.MessageBoard" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'messageBoard.label', default: 'MessageBoard')}" />
        <title><g:message code="default.show.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
        </div>
        <div class="body">
            <h1><g:message code="default.showMessage.label" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="dialog" style="color:black;" >
                <table style="width:500px;">
                    <tbody>
						<tr class="prop">
                            <td valign="top" align="left" style="font-weight:bold;font-family:楷体, arial, helvetica, sans-serif;text-align:left;">
                            	<g:if test="${messageBoardInstance.title.size()>=10}"><label title="${messageBoardInstance.title}" style="color:#16457d;">${messageBoardInstance.title.substring(0,9)}</label> </g:if>
                           		<g:if test="${messageBoardInstance.title.size()<10}"><label style="color:#16457d;">${messageBoardInstance.title}</label></g:if>
                            	(发布者:<label title="${messageBoardInstance.station?.name}">${messageBoardInstance.user})</label></td>

                            <td valign="top" style="color:gray;text-align:right;"><g:formatDate date="${messageBoardInstance.createTime}" /></td>
							
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="name2">
	                            <g:if test="${messageBoardInstance.description.size()>=20}"><label title="${messageBoardInstance.description}">${messageBoardInstance.description.substring(0,20)}</label> </g:if>
                           		<g:if test="${messageBoardInstance.description.size()<20}"><label>${messageBoardInstance.description}</label></g:if>
                           	</td>
                           	
                           	<td valign="top" class="value2">
				            <sec:ifAnyGranted roles="ROLE_ADMIN">
								<g:form style="width:160px;text-align:right;">
				                    <g:hiddenField name="id" value="${messageBoardInstance.id}" />
				                    <g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
	                    			<g:actionSubmit class="reply" action="create" value="${message(code: 'default.button.reply.label', default: 'Reply')}"/>
				               		<g:actionSubmit class="edit" action="edit" value="${message(code: 'default.button.edit.label', default: 'edit')}"/>
			               		</g:form>
			               	</sec:ifAnyGranted>
			               	<sec:ifAnyGranted roles="ROLE_BUSINESS">
								<g:form style="width:160px;text-align:right;">
					                <g:hiddenField name="id" value="${messageBoardInstance.id}" />
					                <g:if test="${messageBoardInstance.user != 'admin'&&messageBoardInstance.isPublic == false }">
		                    		<g:actionSubmit class="edit" action="edit" value="${message(code: 'default.button.edit.label', default: 'edit')}"  />
		                    		</g:if>
			               		</g:form>
	         				</sec:ifAnyGranted>
							</td>
                        </tr>
                    </tbody>
                </table>
	            </div>
	            
            <g:if test="${replyList}">
            	<div style="height:30px;">
		            <h1><g:message code="default.replyMessage.label" /></h1>
				</div>
				
            	<g:each in="${replyList}" var="r">
		            <div class="dialog">
		                <table style="width:500px;">
		                    <tbody>
				                <tr class="prop">
		                            <td valign="top" align="left" style="font-weight:bold;font-family:楷体, arial, helvetica, sans-serif;text-align:left;">
		                            	<g:if test="${r.title.size()>=10}"><label title="${r.title}" style="color:#16457d;">${r.title.substring(0,9)}</label> </g:if>
		                           		<g:if test="${r.title.size()<10}"><label style="color:#16457d;">${r.title}</label></g:if>
		                            	(发布者:<label title="${r.station?.name}">${r.user})</label></td>
		
		                            <td valign="top" style="color:gray;text-align:right;"><g:formatDate date="${r.createTime}" /></td>
									
		                        </tr>
		                        
		                        <tr class="prop">
		                            <td valign="top" class="name2">
			                            <g:if test="${r.description.size()>=20}"><label title="${r.description}">${r.description.substring(0,20)}</label> </g:if>
		                           		<g:if test="${r.description.size()<20}"><label>${r.description}</label></g:if>
		                           	</td>
		                           	
			                        <td valign="top" class="value2">
						            	<sec:ifAnyGranted roles="ROLE_ADMIN">
											<g:form style="width:160px;text-align:right;">
							                    <g:hiddenField name="id" value="${r.id}" />
							                    <g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
				                    			<g:actionSubmit class="edit" action="edit" value="${message(code: 'default.button.edit.label', default: 'edit')}"/>
						               		</g:form>
					               		</sec:ifAnyGranted>
							            <sec:ifAnyGranted roles="ROLE_BUSINESS">
											<g:form style="width:160px;text-align:right;">
											</g:form>
						               	</sec:ifAnyGranted>
					               	</td>
		                        </tr>
		                    </tbody>
		                </table>

		            </div>
	            </g:each>
            </g:if>
        </div>
    </body>
</html>
